package cn.tedu.ivos.inspection.controller;


import cn.tedu.ivos.base.response.JsonResult;
import cn.tedu.ivos.inspection.pojo.dto.InspectionQuery;
import cn.tedu.ivos.inspection.pojo.dto.InspectionSaveParam;
import cn.tedu.ivos.inspection.pojo.vo.InspectionVO;
import cn.tedu.ivos.inspection.service.InspectionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/v1/inspection")
public class InspectionController {

    @Autowired
    private InspectionService inspectionService;


    @RequestMapping("/save")
    public JsonResult save(InspectionSaveParam inspectionSaveParam){
        log.debug("开始处理【保存检查信息】的请求，参数：{}",inspectionSaveParam);
        inspectionService.save(inspectionSaveParam);
        return JsonResult.ok();
    }

    @RequestMapping("/select")
    public JsonResult select(InspectionQuery inspectionQuery){
        log.debug("开始处理【查询检查信息】的请求，参数：{}",inspectionQuery);
        List<InspectionVO> list =inspectionService.select(inspectionQuery);
        return JsonResult.ok(list);
    }

    @RequestMapping("/delete")
    public JsonResult delete(Long id){
        log.debug("开始处理【删除检查信息】的请求，参数：{}",id);
        inspectionService.delete(id);
        return JsonResult.ok();
    }
}
